--*************ANIMATION SUITE****************--
--**************Property of Hxrmn*****************--
--*************Hxrmn@comcast.net*****************--
--DO NOT RE-DISTRIBUTE WITHOUT HXRMN'S CONSENT--
--********************************************--

include( 'shared.lua' )

for k,v in pairs(player.GetAll()) do
	AS_InitPlayer(v)
end

hook.Add( "PlayerInitialSpawn", "AS_InitPlayer", AS_InitPlayer );
hook.Add( "PlayerDisconnected", "AS_EndPlayer", AS_EndPlayer );

if(SERVER) then
	Msg("Initializing Console Commands...\n")
	concommand.Add("AS_PlayX2",function(p,c,a) AS_GetAnimator(p):GetControls():PlayX() end)
	concommand.Add("AS_StopX2",function(p,c,a) AS_GetAnimator(p):GetControls():StopX() end)
	concommand.Add("AS_CaptureFrame",function(p,c,a) AS_GetAnimator(p):CaptureFrame() end)
	concommand.Add("AS_AddEnt",function(p,c,a) AS_GetAnimator(p):GetControls():AddEnt(p,true) end)
	concommand.Add("AS_RemoveEnt",function(p,c,a) AS_GetAnimator(p):GetControls():RemoveEnt(p,true) end)
	concommand.Add("AS_GotoTime",function(p,c,a) AS_GetAnimator(p):GetControls():GotoTime(a[1],true) end)
	concommand.Add("AS_ToggleTrack",function(p,c,a) AS_GetAnimator(p):GetControls():ToggleTrack(a[1],true) end)
	concommand.Add("AS_CapAndAdvance",function(p,c,a) AS_GetAnimator(p):GetControls():CaptureAndAdvance(true) end)
	concommand.Add("AS_Clear",function(p,c,a) AS_GetAnimator(p):GetControls():Clear(true) end)
	concommand.Add("AS_DeleteKey",function(p,c,a) AS_GetAnimator(p):GetControls():DeleteKey(true) end)
	Msg("...Done\n")
end